package com.dbq.fast.common.net;

import java.io.Serializable;

/**
 * Created by sunkai on 2017/10/30.
 */

public class HttpResult<T> implements Serializable {


    /**
     * code : 200
     * msg : 获取成功
     * data : {"vpnNode":{"server":"192.168.1.94","server_port":"10086","password":"marking","method":"aes-256-cfb","config":{"ip":"172.25.0.1","dns":["223.5.5.5","114.114.114.114","8,8,8,8"],"proxy_domain":["qq.com","aiqiyi.com"]},"userServiceName":"经典会员套餐","userSetMealAvailableTime":5,"userSetMealAvailableDataTraffic":"5G"}}
     */

    /**
     * code |  msg           |      explain
     * 200  |  成功          |      查询无异常且有查询结果
     * 425  |  请求不被允许   |      套餐高买低，拒绝
     * 426  |  RESOURCE      |      NOT FOUND 查询无异常没有查询结果
     * 500  |  服务器异常     |      接口bug
     * 401  |  token失效     |      重新获取token
     * 402  |  其他设备登录   |      重新登录
     */
    private int code;
    private String msg;
    private T data;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public boolean isSuccess(){
        return getCode() == 200;
    }
}
